package org.elanfox.intellicommunity.biz.entity.msg;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.elanfox.intellicommunity.biz.entity.BasePO;
import org.elanfox.intellicommunity.common.ienum.MsgEnums;
import org.elanfox.intellicommunity.common.ienum.UserEnums;

import javax.persistence.*;
import java.util.List;

/**
 * 警报组
 * 包含一系列警报消息
 *
 * @author allan
 * @version 1.0.0
 * @date 2019/12/26
 */
@Entity
@Table(name = "ic_alarm_msg_group")
@Setter
@Getter
@Cacheable(false)
@NoArgsConstructor
public class AlarmMsgGroupPO extends BasePO {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long groupId;
    /**
     * 卡用户信息
     */
    @Column(name = "rel_user_id")
    private Integer userId;
    @Column(name = "real_name")
    private String userName;
    @Column(name = "user_mobile")
    private String userMobile;
    @Column(name = "user_type")
    private UserEnums.Type userType;
    /**
     * 当前状态
     */
    @Column(name = "alarm_status")
    private MsgEnums.AlarmStatus alarmStatus;
    /**
     * 报警类型
     */
    @Column(name = "alarm_type")
    private MsgEnums.AlarmType alarmType;
    @OneToMany(mappedBy = "alarmMsgGroupPO", fetch = FetchType.EAGER)
    private List<AlarmMsgPO> alarmMsgPOS;

    public AlarmMsgGroupPO(Long groupId) {
        this.groupId = groupId;
    }
}
